import { getAuth } from '@/request/api.js'
const user = {
	namespaced: true,
	state: {
		authList: [],
		userInfo: {},
		token: ''
	},
	getters: {
		//authLists : state => state.authList
	},
	mutations: {
		changeUserInfo: (state, obj) => {
			state.userInfo = obj
		},
		changeAuthList: (state, obj) => {
			state.authList = obj || []
		},
		changeToken: (state, str) => {
			state.token = str
		}
	},
	actions: {
		getAuthList({ commit }) {
			return new Promise((resolve, reject) => {
				getAuth({})
					.then(res => {
						commit("changeAuthList", res);
						resolve();
					})
					.catch((err) => {
						reject(err);
					});
			});
		}
	}
}

export default user
